package com.ruoyi.project.charge.mapper;

import com.ruoyi.project.charge.domin.ChargeDetail;
import com.ruoyi.project.charge.domin.ChargeQuery;
import com.ruoyi.project.charge.vo.ChargeParams;
import com.ruoyi.project.charge.vo.ChargeQueryParams;
import com.ruoyi.project.charge.vo.RefundParams;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @auther:YU JIANG
 * @date:2021/7/15
 * @time:10:51
 */
@Mapper
public interface ChargeQueryMapper {

    List<ChargeQuery> selectAll(ChargeQueryParams chargeQueryParams);

    @Select("select * from chargedetail where order_id=#{param1}")
    List<ChargeDetail> selectAll2(String order_id);

    @Update("update med_case_medical set pay_status = #{pay_status} where reg_id = #{reg_id}")
    int updateMCM(RefundParams params);

    @Update("update charge set order_status=#{pay_status} where order_id=#{order_id} ")
    int updateCharge(RefundParams chargeParams);

    @Update("update chargedetail set status=#{pay_status} where order_id=#{order_id}")
    int updateChargeDetail(RefundParams chargeParams);

    //创建退款订单
    @Insert("insert into refund values(default,#{order_id},#{reg_id},#{order_id},#{patient_name},#{total_amount},#{payment_method},#{order_status},SYSDATE())")
    int insertRefund(RefundParams params);
}
